package cn.uniqueww.javadesignpatterns.demos.design.factory;

import org.springframework.stereotype.Component;

/**
 * 解析工厂
 * @since 2024/1/17 11:35 上午
 *
 */
@Component
public class ParsingFactory {

        /**
        * 获取解析器
        * @param type
        * @return
        */
        public static IParsing getParsing(String type){
            if("json".equals(type)){
                return new JsonParsing();
            }else if("xml".equals(type)){
                return new XmlParsing();
            }else{
                return null;
            }
        }
}
